var t = require("/0E8B0BC42FB173BF68ED63C34BB4DCA6.js"), e = require("/9A2053A02FB173BFFC463BA74EA4DCA6.js"), n = require("/9F2848A42FB173BFF94E20A398C4DCA6.js");

App({
    globalData: {
        isIpx: !1,
        isPad: !1,
        formIds: [],
        sysInfo: {},
        settings: {
            voiceChecked: !1,
            vibrateChecked: !0,
            autoPunishmentChecked: !0,
            autoStart: !0
        },
        punishment: {
            random: !1,
            envelope: !0,
            drink: !0,
            truth: !0,
            risk: !0
        },
        pokerPunishment: {
            random: !1,
            envelope: !0,
            drink: !0,
            truth: !0,
            risk: !0
        },
        diceStyles: []
    },
    versionLow: function() {
        wx.showToast({
            title: "当前微信版本太低，请升级",
            icon: "none"
        });
    },
    onLaunch: function() {
        var t = this.globalData.sysInfo = wx.getSystemInfoSync(), e = t.statusBarHeight, n = t.model;
        this.loadUserSettings(), this.globalData.isIpx = !!n.match(/iPhone X/i), this.globalData.isPad = !!n.match(/pad/i), 
        this.globalData.statusBarHeight = e;
        var o = wx.getUpdateManager();
        o.onCheckForUpdate(function(t) {
            console.log(t), t.hasUpdate && (o.onUpdateReady(function() {
                wx.showModal({
                    title: "更新提示",
                    content: "新版本已经准备好，是否重启应用？",
                    confirmText: "确认重启",
                    cancelText: "暂不",
                    success: function(t) {
                        console.log(t), t.confirm && o.applyUpdate();
                    }
                });
            }), o.onUpdateFailed(function() {
                wx.showModal({
                    title: "已经有新版本了哟~",
                    content: "新版本已经上线啦~，请您删除当前小程序，重新搜索打开哟~"
                });
            }));
        });
    },
    onShow: function(t) {
        this.initFromStorage();
    },
    initFromStorage: function() {
        var e = wx.getStorageSync("punishment");
        e && (this.globalData.punishment = e);
        var n = wx.getStorageSync("pokerPunishment");
        n && (this.globalData.pokerPunishment = n);
        var o = wx.getStorageSync("diceStyles");
        this.globalData.diceStyles = o || t.DICE_STYLES;
    },
    onError: function(t) {
        var o = wx.getSystemInfoSync();
        if ("devtools" !== o.platform && t) {
            var i = (0, n.$isObject)(t) ? JSON.stringify(t) : t;
            /thirdScriptError/.test(i) && wx.request({
                url: e.DING_API,
                method: "POST",
                data: JSON.stringify({
                    msgtype: "text",
                    text: {
                        content: "酒神器:\n            \n版本：" + e.VERSION + "\n            \n系统：" + JSON.stringify(o) + "\n            \n错误栈：" + i
                    }
                })
            });
        }
    },
    onHide: function() {
        this.globalData.formIds.length && this.submitFormIds();
    },
    collectFormId: function(t) {
        this.globalData.formIds.push(t) >= 5 && this.submitFormIds();
    },
    submitFormIds: function() {},
    loadUserSettings: function() {}
});
// 路羽资源博客 https://www.luyuz.cn/